﻿using CommonEngine.STSDB;
using System;

namespace ManageDB
{
    /// <summary>
    /// 角色配置模块
    /// </summary>
    public class No_RoleMModule : IEn
    {
        /// <summary>
        /// 构造
        /// </summary>
        public No_RoleMModule()
        {
            this.Id = Guid.NewGuid();
        }

        public Guid Id { get; set; }
        /// <summary>
        /// 角色ID
        /// </summary>
        public string RoleId { get; set; }
        /// <summary>
        /// 模块ID
        /// </summary>
        public string ModuleId { get; set; }
        /// <summary>
        /// 业务资源ID
        /// </summary>
        public string ResourceId { get; set; }
        /// <summary>
        /// OP加权--资源操作权限(Flag), 依赖于具体资源定义
        /// </summary>
        public int Grant { get; set; }
        /// <summary>
        /// 是否undetermined(未确定的)
        /// </summary>
        public bool Undetermined { get; set; }
    }

    /// <summary>
    /// 角色关联主体(用户)表
    /// </summary>
    public class No_RolePrincipal : IEn
    {
        /// <summary>
        /// 构造
        /// </summary>
        public No_RolePrincipal()
        {
            this.Id = Guid.NewGuid();
        }

        public Guid Id { get; set; }
        /// <summary>
        /// 角色ID
        /// </summary>
        public string RoleId { get; set; }
        /// <summary>
        /// 主体ID(用户ID)
        /// </summary>
        public string PrincipalId { get; set; }
        /// <summary>
        /// 主体类型代码: U 用户, D 部门, C 公司, P 岗位 - 目前只有用户
        /// </summary>
        public string PrincipalTypeCode { get; set; }
        /// <summary>
        /// 是否启用
        /// </summary>
        public bool Enabled { get; set; }
    }

    /// <summary>
    /// 角色数据许可条件表
    /// </summary>
    public class No_RolePermission : IEn
    {
        /// <summary>
        /// 构造
        /// </summary>
        public No_RolePermission()
        {
            this.Id = Guid.NewGuid();
        }

        public Guid Id { get; set; }
        /// <summary>
        /// 角色ID
        /// </summary>
        public string RoleId { get; set; }
        /// <summary>
        /// 主体ID(用户ID)
        /// </summary>
        public string PrincipalId { get; set; }
        /// <summary>
        /// 配置资源ID
        /// </summary>
        public string ResourceTypeId { get; set; }
        /// <summary>
        /// 资源配置切面表的属性名
        /// </summary>
        public string ResourceProperty { get; set; }
        /// <summary>
        /// 条件操作类型:Collection[0] 集合 Scope[1] 范围
        /// </summary>
        public int OperationType { get; set; }
        /// <summary>
        /// 值类型:Guid[0] DateTime[1] Integer[2]
        /// </summary>
        public int ValueType { get; set; }
        /// <summary>
        /// 条件值(根据操作类型和值类型格式化)
        /// </summary>
        public string Value { get; set; }
    }
}
